package com.ruoyi.vip.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.vip.domain.VipRecharge;
import com.ruoyi.vip.mapper.VipRechargeMapper;
import com.ruoyi.vip.service.IVipRechargeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 会员充值Service业务层处理
 *
 * @author ruoyi
 * @date 2021-04-20
 */
@Service
public class VipRechargeServiceImpl implements IVipRechargeService
{
    @Autowired(required=false)
    private VipRechargeMapper vipRechargeMapper;

    /**
     * 查询会员充值
     *
     * @param rechargeId 会员充值ID
     * @return 会员充值
     */
    @Override
    public VipRecharge selectVipRechargeById(Long rechargeId)
    {
        return vipRechargeMapper.selectVipRechargeById(rechargeId);
    }

    /**
     * 查询会员充值列表
     *
     * @param vipRecharge 会员充值
     * @return 会员充值
     */
    @Override
    public List<VipRecharge> selectVipRechargeList(VipRecharge vipRecharge)
    {
        return vipRechargeMapper.selectVipRechargeList(vipRecharge);
    }

    /**
     * 新增会员充值
     *
     * @param vipRecharge 会员充值
     * @return 结果
     */
    @Override
    public int insertVipRecharge(VipRecharge vipRecharge)
    {
        vipRecharge.setCreateTime(DateUtils.getNowDate());
        return vipRechargeMapper.insertVipRecharge(vipRecharge);
    }

    /**
     * 修改会员充值
     *
     * @param vipRecharge 会员充值
     * @return 结果
     */
    @Override
    public int updateVipRecharge(VipRecharge vipRecharge)
    {
        return vipRechargeMapper.updateVipRecharge(vipRecharge);
    }

    /**
     * 批量删除会员充值
     *
     * @param rechargeIds 需要删除的会员充值ID
     * @return 结果
     */
    @Override
    public int deleteVipRechargeByIds(Long[] rechargeIds)
    {
        return vipRechargeMapper.deleteVipRechargeByIds(rechargeIds);
    }

    /**
     * 删除会员充值信息
     *
     * @param rechargeId 会员充值ID
     * @return 结果
     */
    @Override
    public int deleteVipRechargeById(Long rechargeId)
    {
        return vipRechargeMapper.deleteVipRechargeById(rechargeId);
    }
}
